package com.wedo.mall.activity.register;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.e.library.activity.EActivity;
import com.wedo.mall.R;
import com.wedo.mall.activity.ProtocolActivity;

import butterknife.BindDrawable;
import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by lxy on 2017/6/14.
 */

public class RegisterActivity extends EActivity {

    @BindView(R.id.tv_username) TextView tv_username;
    @BindDrawable(R.drawable.zc_xl_icn) Drawable icon_down;

    @BindView(R.id.btn_phone) Button btn_phone;
    @BindView(R.id.v_phone) View v_phone;

    @BindView(R.id.btn_email) Button btn_email;
    @BindView(R.id.v_email) View v_email;


    @Override
    protected int layout() {
        return R.layout.activity_register;
    }

    @Override
    protected void onActivityCreated(Bundle state) {
        icon_down.setBounds(0,0,icon_down.getMinimumWidth(),icon_down.getMinimumHeight());
        onPhoneClick();
    }

    @OnClick(R.id.btn_phone)
    protected void onPhoneClick(){
        btn_phone.setSelected(true);
        btn_email.setSelected(false);
        v_phone.setVisibility(View.VISIBLE);
        v_email.setVisibility(View.INVISIBLE);
        tv_username.setText("手机号 +86");
        tv_username.setClickable(true);
        tv_username.setPadding(0,0,0,0);
        tv_username.setCompoundDrawables(null,null,icon_down,null);
    }

    @OnClick(R.id.btn_email)
    protected void onEmailClick(){
        btn_phone.setSelected(false);
        btn_email.setSelected(true);
        v_phone.setVisibility(View.INVISIBLE);
        v_email.setVisibility(View.VISIBLE);
        tv_username.setText("邮箱");
        tv_username.setClickable(false);
        tv_username.setPadding(0,0,0,22);
        tv_username.setCompoundDrawables(null,null,null,null);
    }

    @OnClick(R.id.tv_username)
    protected void onUsernameClick(){

    }


    @OnClick(R.id.btn_seller)
    protected void onSellerClick(){
        toActivity(SellerInfoActivity.class);
    }

    @OnClick(R.id.btn_protocol)
    protected void onProtocolClick() {
        toActivity(ProtocolActivity.class);
    }
}
